import java.util.Calendar;
import java.util.GregorianCalendar;

/* Assignment Week 3 */

//      Creating Class
class Person {

	private String name;
	private int Year_of_Birth;
	private long social_security_number;

	// Constructor with 3 args
	Person(String pname, int pyob, long pssn) {

		name = pname;
		Year_of_Birth = pyob;
		social_security_number = pssn;

	}

	// Method to display the datails
	public void display_details() {
		System.out.println(name);
		System.out.println(Year_of_Birth);
		System.out.println(social_security_number);
	}

	// Method to calculate the Age
	public int getAge() {

		int Age;
		Calendar cal = new GregorianCalendar();
		int year = cal.get(Calendar.YEAR); 
		Age = year - Year_of_Birth;
		return Age;
//		System.out.println(Age);

	}
}

// Main method
public class PersonApp // Main Method
{

	public static void main(String args[]) {

		// Declaring and Instantiating the classobject Person
		Person aperson = new Person("Professor Ketan", 1980, 13456);
		Person anotherperson = new Person("aname", 1999, 123456778);
		// Accessing Person (class) members.

		aperson.display_details();
		System.out.println(aperson.getAge());
		anotherperson.display_details();
		System.out.println(anotherperson.getAge());
		System.out.println();

	}
}
